/**
 * @file sequention_queue.h
 * @brief 顺序队列头文件
 * @author Xavier ZXY (zxy_xavier@163.com)
 * @version : 1.0
 * @date 2022-05-01
 * 
 */

#define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0
#define MAXSIZE 20 /* 存储空间初始分配量 */

typedef int Status; 
typedef int QElemType; /* QElemType类型根据实际情况而定，这里假设为int */

typedef struct
{
    QElemType data[MAXSIZE];
    int front;  //头指针
    int rear;  //尾指针
}SqQueue;


/**
 * @brief 打印元素
 * @param  c                 
 * @return Status 
 */
Status visit(QElemType c);

/**
 * @brief 初始化一个空队列
 * @param  Q                 
 * @return Status 
 */
Status init_queue(SqQueue *Q);

/**
 * @brief 将队列Q清空
 * @param  Q                 
 * @return Status 
 */
Status clear_queue(SqQueue *Q);

/**
 * @brief 队列Q是否为空队列
 * @param  Q                 
 * @return Status 
 */
Status is_empty_queue(SqQueue Q);

/**
 * @brief Get the length
 * @param  Q                 
 * @return int 
 */
int get_length(SqQueue Q);

/**
 * @brief Get queue header element
 * @param  Q                 
 * @param  e                 
 * @return Status 
 */
Status get_head(SqQueue Q, QElemType *e);

/**
 * @brief if the queue is not full, insert a new tail element e
 * @param  Q                 
 * @param  e                 
 * @return Status 
 */
Status insert_tail(SqQueue *Q, QElemType e);

/**
 * @brief if the queue is not empty, delete the header element and
 *          return its value with e
 * @param  Q                 
 * @param  e                 
 * @return Status 
 */
Status delete_head(SqQueue *Q, QElemType *e);

/**
 * @brief Traverse all elements in the queue
 * @param  Q                 
 * @return Status 
 */
Status traverse_queue(SqQueue Q);